package com.ansorgit.helpful.smartHome;

import com.ansorgit.helpful.AbstractEditorHandler;
import com.ansorgit.helpful.SearchDirection;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;

/**
 * User: jansorg
 * Date: Mar 6, 2010
 * Time: 8:38:42 PM
 */
public class SmartHomeHandler extends AbstractEditorHandler {
    public SmartHomeHandler() {
        super(true, SearchDirection.Backwards);
    }

    @Override
    protected void selectionAction(Editor editor, SelectionModel selectionModel) {
        placeCaretAt(editor, selectionModel.getSelectionStart());
    }

    @Override
    protected void elementAction(Project project, PsiElement psiElement, Editor editor) {
        placeCaretAt(editor, psiElement.getTextRange().getStartOffset());
    }
}